function gadget:GetInfo()
    return {
        name = "Repair ability",
        desc = "Repairs a unit",
        author = "Sean Heron",
        date = "January 2009",
        license = "GNU GPL v2, or later",
        layer = 3, -- watchout for which layer!
        enabled = true
    }
end


local CMD_REPAIR = 32300

local lastrepair = {}

--############# repair settings #####################
local repairData = {
				[1] = 	{
						repairedHP = 500,
						cooldown = 45
						},

				[2] = 	{
						repairedHP = 1000,
						cooldown = 35
						},

				[3] = 	{
						repairedHP = 1500,
						cooldown = 30
						}


				}
--################################################



if (gadgetHandler:IsSyncedCode()) then
--SYNCED

function gadget:CommandFallback(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions, cmdTag)

    --check if this is command was emmitted by the repair-button
    if (CMD_REPAIR ~= cmdID) then
        return false
    end

	--get repair level
	local repairLevel = _G.AllEngines:GetEngineByUnitID(unitID):GetAbilityLvl(0)
		--by now we have 3 levels for emp... this problem has to be solved better!
		if (repairLevel > 3) then
			repairLevel = 3
		end

	--handle cooldown
	if (lastrepair[unitID]~=nil)and(lastrepair[unitID]+repairData[repairLevel].cooldown > Spring.GetGameSeconds()) then
		Spring.Echo("Repair not ready! (Cooldown:"..(Spring.GetGameSeconds()-lastrepair[unitID]-repairData[repairLevel].cooldown)..")")
		return true,true
	else
		lastrepair[unitID] = Spring.GetGameSeconds()
	end

	--get target
	local tx,ty,tz
	tx = cmdParams[1]
	ty = cmdParams[2]
	tz = cmdParams[3]
	-- get all units in cylinder
    unitToBeRepaired = Spring.GetUnitsInCylinder(tx,tz, 20)

	if (unitToBeRepaired==nil) then --no target
		lastrepair[unitID] = 0
		Spring.Echo("Error: Select a unit which you want to repair!")
		return true,true
	end

    --check for every unit if it's allied. If not, stun.
    for index,unit in pairs(unitToBeRepaired) do
        if (Spring.GetUnitTeam(unit)~=nil) then
            if (Spring.AreTeamsAllied(Spring.GetUnitTeam(unit),teamID)) then
            	currentHealth = Spring.GetUnitHealth(unit)
            	Spring.SetUnitHealth(unit,currentHealth+repairData[repairLevel].repairedHP)
                Spring.Echo("Repair Unit: "..unitID.." by "..repairData[repairLevel].repairedHP.." HP ".."(current HP: "..currentHealth..")")
            end
        end
    end

    return true,true

end


end